<template>
	<view>
		<u-no-network image="/static/images/nonet.png"></u-no-network>
		<!-- <u-navbar :background="navBarBg" :borderBottom="false" :height="20" :isBack="false"></u-navbar> -->
		<view class="top">
			<view class="userImg">
				<u-avatar size="large" :src="headerImg"></u-avatar>
			</view>
			<view class="userInfo">
				<!-- <u-parse :html="getUserInfo"></u-parse> -->
			</view>
		</view>
		<view class="list">
			<view class="u-m-t-201">
				<u-cell-group :border="false">
					<u-cell-item :border-top="false" :border-bottom="false" :title-style="cellText" :icon-style="cellIcon" icon-size="38" icon="bell" title="资讯" @click="itemClick(0)"></u-cell-item>
				</u-cell-group>
			</view>
			
			<view class="u-m-t-201">
				<u-cell-group :border="false">
					<u-cell-item :border-top="false" :border-bottom="true" :title-style="cellText" :icon-style="cellIcon" icon-size="38" icon="info-circle" title="关于李沧妇幼" @click="itemClick(1)"></u-cell-item>
					<u-cell-item :border-top="false" :border-bottom="true" :title-style="cellText" :icon-style="cellIcon" icon-size="38" icon="question-circle" title="帮助主题" @click="itemClick(2)"></u-cell-item>
					<u-cell-item :border-top="false" :border-bottom="true" :title-style="cellText" :icon-style="cellIcon" icon-size="38" icon="file-text" title="用户协议" @click="itemClick(3)"></u-cell-item>
					<u-cell-item :border-top="false" :border-bottom="true" :title-style="cellText" :icon-style="cellIcon" icon-size="38" icon="email" title="问题反馈" @click="itemClick(4)"></u-cell-item>
					<u-cell-item :border-top="false" :border-bottom="false" :title-style="cellText" :icon-style="cellIcon" icon-size="38" icon="trash" title="清理缓存" :arrow="false" @click="itemClick(5)"></u-cell-item>
				</u-cell-group>
			</view>
			
			<view class="u-m-t-201">
				<u-cell-group :border="false">
					<u-cell-item :border-top="false" :border-bottom="false" :title-style="cellText" :icon-style="cellIcon" icon-size="38" icon="lock" title="修改登录密码" @click="itemClick(6)"></u-cell-item>
					<u-cell-item :border-top="false" :border-bottom="false" :title-style="cellText" :icon-style="cellIcon" icon-size="38" icon="account" title="注销登录" :arrow="false" @click="itemClick(7)"></u-cell-item>
				</u-cell-group>
			</view>
		</view>
	</view>
</template>

<script>
	import common from "@/common/common.js"; 
	export default {
		data() {
			return {
				navBarBg: {backgroundImage: "linear-gradient(90deg, #ff80a8, #FE65A4)"},
				cellText: {fontSize:"32rpx"},
				cellIcon: {color:"#e25992", "margin-right": "20rpx", "font-weight":"100"},
				headerImg: "",				//头像
				personInfo:{},
			}
		},
		onShow() {
			if (!(common.checkPerson())) 
				return;
				

			this.personInfo = getApp().globalData.PersonInfo;
			if (this.$wechat) {
				let wxInfo = getApp().globalData.WXUserInfo;
				this.headerImg = wxInfo.headimgurl;
			}
		},
		methods: {
			btnSettingClick(){
				uni.navigateTo({
					url: "./setting"					
				})
			},
			itemClick(tag) {
				switch(tag) {
					case 0:				//消息
						uni.switchTab({
						    url: '../news/news'
						});
						break;
					case 1:				//关于
						uni.navigateTo({
						    url: '/pages/doc/about'
						});
						break;
					case 2:				//帮助主题
						uni.navigateTo({
						    url: '/pages/doc/help'
						});
						break;
					case 3:				//用户协议
						uni.navigateTo({
						    url: '/pages/doc/protocol'
						});
						break;
					case 4:				//问题反馈
						uni.navigateTo({
						    url: '/pages/doc/suggest'
						});
						break;
					case 5:				//清理缓存
						// uni.navigateTo({
						//     url: '/pages/doc/suggest'
						// });
						break;
					case 6:				//修改密码
						uni.navigateTo({
						    url: '/pages/mine/changPwd'
						});
						break;
					case 7:				//注销登录
						uni.showModal({
							title: '提示',
							content: '您确实要注销吗？',
							success: function (res) {
								if (res.confirm) {
									getApp().globalData.PersonInfo = null;
									if (!common.checkPerson())
										return;
								}
							}
						});
						break;
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.top {
		background-repeat: no-repeat;
		background-image: url("@/static/bannerBg.png"), linear-gradient(90deg, #ed9db2, #ed9db2);
		background-size: 100% 110rpx, 100% 100%;
		background-position: bottom center, center center;
		height: 210rpx;
		font-size: 55rpx;
		color: #fff;
		text-shadow: 4rpx 4rpx 4rpx rgba(0, 0, 0, 0.3);
	}
	.userImg, .userInfo {
		margin: 10rpx 40rpx;
		display: block;
		float: left;
		line-height: 55rpx;
	}
	
	.list{
		position: relative;
		top: -90rpx;
		margin: 18rpx;
		// box-shadow: 0 0 8rpx #ccc;
		border-radius: 15rpx;
		// background-color: #eee;
	}
	.u-m-t-201 {
		border-radius: 15rpx;
		padding: 6rpx;
		background-color: #fff;
		// background-color: red;
		margin-bottom: 25rpx;
		// box-shadow: 0 0 8rpx 1rpx #ccc;
		box-shadow: 1rpx 1rpx 8rpx #ccc, 1rpx 1rpx 5rpx #ccc;
		
		
	}
	.grid-text {
		color: #333;
		font-size: 30rpx;
	}

	.main {
		background-color: #fff;
		// margin-top: calc(60rpx + var(--status-bar-height));
		// flex: 1;
		border-radius: 30rpx;
		position: relative;
		top: -80rpx;
		margin: 0rpx 20rpx;
		
		// padding: 0rpx 30rpx;
		
	}
	
	.list {
		margin: 30rpx 30rpx;
		// border-radius: 60rpx;
		position: relative;
		
		// top: -30rpx;
		// flex: 1;
		// z-index: 100;
	}
	.text {
		font-size: 32rpx;
	}

</style>
